<template>
  <div class="depositsAndLoans">
    <div class="item" v-for="(item, index) in dataList" :key="index">
      <div class="left">
        <div class="lefticon" :class="'lefticon' + index"></div>
        <div class="lefttext">
          <p class="leftname">{{item.cdxx}}</p>
          <p><b>{{item.je}}</b>亿元</p>
        </div>
      </div>
      <div class="right">
        <p>全省第&nbsp;<b>{{item.qspm}}</b></p>
        <p class="percent"  :class="{ greenpercent: item.tb < 0 }">{{item.tb}}%</p>
      </div>
    </div>
  </div>
</template>

<script>
import { getAction } from '@/api/manage.js'

export default {
  data() {
    return {
      dataList: []
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    getData() {
      getAction('/topic/data/listAllBySql/dy_app_xxzb_jrjgcdkqk').then(
        (res) => {
          if (res.result) {
            this.dataList = res.result
          }
        }
      )
    }
  }
}
</script>

<style lang="scss" scoped>
.depositsAndLoans {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  .item {
    width: 411px;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    box-sizing: border-box;
    margin-bottom: 30px;
    background: url('../images/depositsAndLoans-bg.png')no-repeat center bottom;
    background-size: 100% 78px;
    .left {
      display: flex;
      align-items: center;
      .lefticon {
        width: 103px;
        height: 86px;
        &.lefticon0 {
          background: url("../images/depositsAndLoans-in.png") no-repeat center;
          background-size: 100% 100%;
        }
        &.lefticon1 {
          background: url("../images/depositsAndLoans-out.png") no-repeat center;
          background-size: 100% 100%;
        }

      }
      .lefttext {
        width: 180px;
        p {
          font-family: MicrosoftYaHeiUI;
          font-size: 16px;
          color: #ffffff;
          text-align: left;
          font-style: normal;
          text-transform: none;
          b {
            font-family: YouSheBiaoTiHei;
            font-size: 24px;
            color: #FFDE00;
            text-align: left;
            font-style: normal;
            text-transform: none;
          }
        }
      }
    }
    .right {
      width: 100px;
      font-family: MicrosoftYaHeiUI;
      font-size: 14px;
      color: #fffffe;
      line-height: 25px;
      text-align: left;
      font-style: normal;
      text-transform: none;
      b {
        font-family: MicrosoftYaHeiUI, MicrosoftYaHeiUI;
        font-weight: bold;
        font-size: 18px;
        color: #ffde00;
        text-align: left;
        font-style: normal;
        text-transform: none;
      }
      .percent {
        height: 32px;
        line-height: 32px;
        color: #ff3e3e;
        padding-left: 10px;
        font-size: 18px;
        font-weight: bold;
        box-sizing: border-box;
        position: relative;
        &::before {
          content: "";
          width: 8px;
          height: 12px;
          background: url("../images/up-arrow.png") no-repeat;
          background-size: 100% 100%;
          position: absolute;
          left: 0;
          top: 50%;
          margin-top: -5px;
        }
         &.greenpercent {
          color: #18c624;
          &::before {
            content: "";
            width: 8px;
            height: 12px;
            background: url("../images/down-arrow.png") no-repeat;
            background-size: 100% 100%;
            position: absolute;
            left: 0;
            top: 50%;
            margin-top: -5px;
          }
        }
      }
    }
  }
}
</style>
